﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Clipping.Utils
{
    class UriHelper
    {
        public static Uri ConstructAbsoluteUrl(Uri baseUri, string url)
        {
            Uri rtn = null;
            if (!string.IsNullOrEmpty(url))
            {
                if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
                {
                    rtn = new Uri(url);
                }
                else if (baseUri != null)
                {
                    try
                    {
                        rtn = new Uri(baseUri, url);
                    }
                    catch (Exception ex) { }
                }
            }
            return rtn;
        }
    }
}
